package model;

public enum FieldsType {
		MONITOR("1"),LOCATION("2"),TIMESTAMP("3");
		private String value;
		private FieldsType(String value){
			this.value = value;
		}
		public String value(){
			return value;
		}
		public static FieldsType getInstance(String value){
			FieldsType result=null;
			switch (value) {
			case "1":
				result = Enum.valueOf(FieldsType.class, "MONITOR");
				break;
			case "2":
				result = Enum.valueOf(FieldsType.class, "LOCATION");
				break;
			case "3":
				result = Enum.valueOf(FieldsType.class, "TIMESTAMP");
				break;
			default:
				throw new IllegalArgumentException(value+" not exists in FieldsType");
			}
			
			return result;
		}
		public static void main(String[] args) {
			System.out.println(getInstance("1"));
			System.out.println(getInstance("2"));
			System.out.println(getInstance("3"));
			System.out.println(getInstance("4"));
		}
}
